package qit.itmiaojie;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import qit.itmiaojie.dao.RoleDao;
import qit.itmiaojie.dao.UserDao;
import qit.itmiaojie.pojo.Role;
import qit.itmiaojie.pojo.User;
import qit.itmiaojie.service.RoleService;
import qit.itmiaojie.service.UserService;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")

public class test {
    @Autowired
    private RoleService roleService;

    @Autowired
    private RoleDao roleDao;
    @Autowired
    private UserDao userDao;
    @Autowired
    private UserService userService;
    @Test
    public void test1(){
        System.out.println(roleService);
        List<Role> all = roleService.findAll();
        System.out.println(all);
    }

    @Test
    public void test2(){
        List<Role> roleByUserId = roleDao.findRoleByUserId(1L);
        System.out.println(roleByUserId);
    }


    @Test
    public void test3(){
        List<User> all = userService.findAll();
        System.out.println(all);
    }



}
